package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.OperSMapper;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.OperateQueryParam;
import com.itheima.pojo.PageTwo;
import com.itheima.service.OperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperServiceImpl implements OperService {

@Autowired
   private OperSMapper  operSMapper;
    @Override
    public PageTwo page(OperateQueryParam operateQueryParam) {
        PageHelper.startPage(operateQueryParam .getPage(),operateQueryParam.getPageSize());

        List<OperateLog> list = operSMapper.list(operateQueryParam);
        Page<OperateLog> p = (Page<OperateLog>) list;
        return new PageTwo(p.getTotal(),p.getResult());
    }
}
